Exceptional Continuations in JavaScript
نویسنده
چکیده
JavaScript, the main language for web-site development, does not feature continuation. However, as part of client-server communication they would be useful as a means to suspend the currently running execution. In this paper we present our adaption of exception-based continuations to JavaScript. The enhanced technique deals with closures and features improvements that reduce the cost of the work-around for the missing goto-instruction. We furthermore propose a practical way of dealing with exception-based continuations in the context of non-linear executions, which frequently happen due to callbacks. Our benchmarks show that under certain conditions continuations are still expensive, but are often viable. Especially compilers translating to JavaScript could benefit from static control flow analyses to make continuations less costly.
منابع مشابه
Continuations pour la programmation de comportement d'agent
Continuations are a well established programming concept that allows capturing and resuming the current program state. They can be found in several functional programming languages (such as Scheme), in Hewitt actor model, and more recently in dynamic programming languages (such as Ruby, Smalltalk, Python, and even Javascript or Java). They have been historically applied to automaton programming...
متن کاملUtilisation des continuations pour l'ingénierie d'agents conversationnels
RÉSUMÉ. Les continuations sont un concept de programmation bien établi permettant de capturer explicitement l’état du programme en cours. Elles sont présentes dans des langages de programmation fonctionnelle (par exemple Scheme), dans le modèle d’acteurs de Hewitt, et depuis peu dans des langages dynamiques (tels que Ruby, Smalltalk, Python, Javascript, Java). Elles ont été historiquement appli...
متن کاملJ Is for JavaScript: A Direct-Style Correspondence between Algol-Like Languages and JavaScript Using First-Class Continuations
It is a time-honored fashion to implement a domain-specific language (DSL) by translation to a general-purpose language. Such an implementation is more portable, but an unidiomatic translation jeopardizes performance because, in practice, language implementations favor the common cases. This tension arises especially when the domain calls for complex control structures. We illustrate this tensi...
متن کاملCompiling Scheme to JavaScript
This paper presents SCM2JS a compiler that translates a variant of the Scheme programming language into JavaScript. On the one hand, some Scheme features are missing, amongst which the most important are the lack of support for continuations, the absence of exact numbers, and a partial treatment of tail recursions. On the other hand, some extensions are added for improving the connection betwee...
متن کاملContinuations and Behavior Components Engineering in Multi-Agent Systems
Continuations are a well established programming concept, allowing to explicitly capture and resume the current program state. They are present in several functional programming languages (such as Scheme), in concurrent models such as Hewitt actor model or process calculi, and more recently in dynamic programming languages (such as Ruby, Smalltalk, Python, and even Javascript or Java). They hav...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2007